regressAll <- function(outcome, covars, dat, model = "linear", outcomeIsFactor = FALSE, alwaysInclude = NULL){
	
	reg.out <- list()
	library(gregmisc)
	pmat <- permutations(2, length(covars), c(0,1), repeats.allowed = TRUE)
	
	if(!(is.null(alwaysInclude))){
		idx <- NULL
		for(i in 1:nrow(pmat)){
			if(0 %in% pmat[i, which(covars %in% alwaysInclude)]){
				idx <- append(idx, i)
			}
		}
		pmat <- pmat[-idx, ]
	}

	for(i in 1:nrow(pmat)){
		tmp <- covars[as.logical(pmat[i, ])]
		if(length(tmp) == 0){
			tmp <- "1"
		}
		if(length(tmp) == 1){
			#fff <- as.formula(paste(outcome, " ~ ", tmp, sep = ""))
			xv <- tmp
		}else{
			xv <- NULL
			for(xxxv in 1:(length(tmp)-1)){
				xv <- paste(xv, tmp[xxxv], " + ", sep = "")
			}
			xv <- paste(xv, tmp[length(tmp)], sep = "")
		}	
		
		fff <- as.formula(paste(outcome, " ~ ", xv, sep = ""))
		if(outcomeIsFactor == TRUE){
			fff <- as.formula(paste("I(as.numeric(as.factor(", outcome, "))) ~ ", xv, sep = ""))		
		}
		
		if(model == "linear"){
			reg.out[[i]] <- lm(fff, dat)
		}
		if(model == "logit"){
			reg.out[[i]] <- glm(fff, dat, family = binomial(link = "logit"))
		}
	}
	return(reg.out)
}
